package com.link.server;

import com.link.server.ws.WebSocketNettyServer;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@SpringBootApplication(scanBasePackages = {"com.link.database","com.link.server","com.link.common"})
@MapperScan({"com.link.database.dao"})
public class LinkChannelServerApplication {
    @Resource
    private WebSocketNettyServer server ;
    //单线程
    ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
    @PostConstruct

    public void initWebSocket(){
        singleThreadExecutor.execute(()->{
            server.init();
        });
    }
    public static void main(String[] args) {
        SpringApplication.run(LinkChannelServerApplication.class, args);
    }

}
